-
Notifications
You must be signed in to change notification settings - Fork 3
Modernization #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernization #50
Conversation
… body & pass original errors in CoreSdkError
lib/utils/error.utils.ts
Outdated
| return `Response failed with status '${adapterResponse.status}' and status text '${adapterResponse.statusText}'.${kontentErrorResponse.message}${validationErrorMessage ? ` ${validationErrorMessage}` : ""}`; | ||
| } | ||
|
|
||
| return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably fallback to some string like "unknown error" or returned the stringified response or something. that way you could simplify the return value of getErrorMessage on line 22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unknown error should be reserved for cases which are not accounted for. In this case, I want to give the user a "friendly" error message with status codes & flattened validation error message. This case only happens when the requests itself succeeds, but fails due to Kontent.ai validation.
I did simplify the code here a bit though :)
Motivation
Which issue does this fix? Fixes #
issue numberIf no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?
Checklist
How to test
If manual testing is required, what are the steps?